<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateFeeAnnualChangesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('fee_annual_changes', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('shopId')->default(0);
            $table->string('feeOrderNo', 64)->default('')->comment('订单号');
            $table->string('field', 64)->default('')->comment('字段名');
            $table->string('beforeValue', 64)->default('')->comment('改动前的值');
            $table->string('afterValue', 64)->default('')->comment('改动后的值');

            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->string('createdByName')->default('')->comment('创建人');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment = '年费订单 - 改动日志';

            $table->index('feeOrderNo', 'idx_feeOrderNo');
            $table->index('shopId', 'idx_shopId');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('fee_annual_changes');
    }
}
